<!DOCTYPE html >
<html lang="zh">
<head>
<title>订单详情</title>
  <{include file="public/header" /}>
  <style>
    .pay{

      margin-top:unset !important;
      margin-left: 10px;
    }
    .btn-2{
      width: 45%;float: left;
    }
    .btn-3{
      display: flex;
      flex-direction: column;
      margin-top: 10px !important;
    }
    .mg10-0 {
      margin: 10px 0;
      overflow: hidden;
      text-align: center;
    }

  </style>
</head>
<body ontouchstart>
<!--主体-->
<header class="wy-header">
  <div class="wy-header-icon-back"><span></span></div>
  <div class="wy-header-title">订单</div>
</header>
<div class="weui-content">
  <div class="wy-media-box weui-media-box_text address-select">
    <div class="weui-media-box_appmsg">
      <div class="weui-media-box__hd proinfo-txt-l" style="width:20px;"><span class="promotion-label-tit">
        <img src="/static/mall/images/icon_nav_city.png" /></span></div>
      <div class="weui-media-box__bd">
        <a href=""  class="weui-cell_access addr">
          <h4 class="address-name"><span class="addr-username"></span><span class="addr-mobile"></span></h4>
          <div class="address-txt addr-detail"></div>
        </a>
      </div>
      <div class="weui-media-box__hd proinfo-txt-l" style="width:16px;"><div class="weui-cell_access"><span class="weui-cell__ft"></span></div></div>
    </div>
  </div>
  <div class="wy-media-box weui-media-box_text">
    <div class="weui-media-box__bd " id="pro-list">

      <!--<div class="weui-media-box_appmsg ord-pro-list">
        <div class="weui-media-box__hd"><a href="pro_info.html"><img class="weui-media-box__thumb" src="/static/mall/upload/pro3.jpg" alt=""></a></div>
        <div class="weui-media-box__bd">
          <h1 class="weui-media-box__desc"><a href="pro_info.html" class="ord-pro-link">蓝之蓝蓝色瓶装经典Q7浓香型白酒500ml52度高端纯粮食酒2瓶装包邮</a></h1>
          <p class="weui-media-box__desc">规格：<span>红色</span>，<span>23</span></p>
          <div class="clear mg-t-10">
            <div class="wy-pro-pri fl">¥<em class="num font-15">296.00</em></div>
            <div class="pro-amount fr"><span class="font-13">数量×<em class="name">1</em></span></div>
          </div>
        </div>
      </div>-->
    </div>
  </div>
  <div class="weui-panel">
    <div class="weui-panel__bd">
      <div class="weui-media-box weui-media-box_small-appmsg">
        <div class="weui-cells">
          <div class="weui-cell weui-cell_access">

            <div class="weui-cell__bd weui-cell_primary">
              <p class="font-14"><span class="mg-r-10">配送方式</span><span class="fr send-type">快递</span></p>
            </div>

          </div>
          <div class="weui-cell weui-cell_access tihuo_box" style="display: none">

            <div class="weui-cell__bd weui-cell_primary">
              <p class="font-14"><span class="mg-r-10">提货地址</span><span class="fr tihuo_address">快递</span></p>
            </div>

          </div>
          <a class="weui-cell weui-cell_access" href="javascript:switchCoupon()">
            <div class="weui-cell__bd weui-cell_primary">
              <p class="font-14"><span class="mg-r-10">优惠券</span><span class="sitem-tip"><em class="num coupon-count">0</em>张可用<em class="coupon-desc"></em></span></p>
            </div>
            <span class="weui-cell__ft"></span>
          </a>
          <div class="weui-form__control-area coupon-list" style="display: none">
            <div class="weui-cells__group weui-cells__group_form">
              <div class="weui-cells weui-cells_radio coupon-list-items"></div>
            </div>
          </div>
          <!--<div class="weui-cell weui-cell_access" href="javascript:;">
            <div class="weui-cell__bd weui-cell_primary">
              <p class="font-14"><span class="mg-r-10">运费</span><span class="fr txt-color-red">￥<em class="num">10.00</em></span></p>
            </div>
          </div>
          <a class="weui-cell weui-cell_access" href="money.html">
            <div class="weui-cell__bd weui-cell_primary">
              <p class="font-14"><span class="mg-r-10">可用积分</span><span class="sitem-tip"><em class="num">1235</em>个</span></p>
            </div>
            <span class="weui-cell__ft"></span>
          </a>
          -->
        </div>
      </div>
    </div>
  </div>
  <div class="wy-media-box weui-media-box_text btn-group-bb">
    <div class="mg10-0 t-c">总金额：<span class="wy-pro-pri mg-tb-5">¥<em class="num font-20 totalMoney">0.00</em></span></div>
    <div class="mg10-0">
      <a href="javascript:create('wechat')" class="weui-btn weui-btn_primary pay pay-wechat" style="display: none">微信付款</a>
      <a href="javascript:create('alipay')" class="weui-btn   pay pay-alipay" style="display: none;background-color: #1111e0a8">支付宝</a>
      <a href="javascript:create('credit')" class="weui-btn weui-btn_default pay pay-credit"  style="display: none">余额支付</a>
      <div id="alipay-form" style="display: none"></div>
    </div>
  </div>
  <div class="wy-media-box weui-media-box_text btn-group-cc " style="display: none">
    <div class="mg10-0 t-c">总金额：<span class="wy-pro-pri mg-tb-5">¥<em class="num font-20 totalMoney">0.00</em></span></div>
    <div class="mg10-0">
      <a href="javascript:void(0) " class="weui-btn weui-btn-area weui-btn_default shop_tel">联系店家</a>
    </div>
  </div>
</div>
<{include file="public/footer" /}>
<{include file="public/weixin_jsapi" /}>
<{include file="public/_info_js" /}>
<script>
  var shoptype = 0;
  shop_config();

  var addr_id = bs_get_param('addr_id')
  let logCode = bs_get_param('logCode');
  let coupon_code = null;
  var order_sn = null;
  getData();

  function getData() {
    bs_request("<{:url('/mall/order/ready')}>", {addr_id: addr_id, logCode: logCode}, function (res) {
      if (res.code != 0) {
        $.confirm(res.msg, function () {
          location.href = "<{:url('/mall/home/index')}>"
        })
      }

      if (!in_array(shoptype, [2, 3])) {
        if (res.data.address) {
          $(".addr-username").html(res.data.address.username);
          $(".addr-mobile").html(res.data.address.mobile);
          $(".addr-detail").html(res.data.address.province + ' ' + res.data.address.city + ' ' + res.data.address.area + ' ' + res.data.address.address);
          $(".addr").attr('href', "<{:url('/mall/user/address_list')}>?from=info2")
          addr_id = res.data.address.id;
        } else {
          $(".addr-username").html('<div style="    color: red;margin-top: 20px;font-size: 18px;line-height: 20px;">请先添加地址</div>');
          $(".addr").attr('href', "<{:url('/mall/user/address_list')}>?from=info2")
        }
      } else {
        $(".address-select").hide();
      }

      var goods = res.data.goods_list;
      var item = '';
      for (var i = 0; i < goods.length; i++) {
        item += ' <div class="weui-media-box_appmsg ord-pro-list">\n' +
                '        <div class="weui-media-box__hd"><a href="<{:url(\'/mall/goods/detail\')}>?id=' + goods[i].goods_id + '"><img class="weui-media-box__thumb" src="' + goods[i].thumb + '" alt=""></a></div>\n' +
                '        <div class="weui-media-box__bd">\n' +
                '          <h1 class="weui-media-box__desc"><a href="<{:url(\'/mall/goods/detail\')}>?id=' + goods[i].goods_id + '" class="ord-pro-link">' + goods[i].title + '</a></h1>\n' +
                '          <!--<p class="weui-media-box__desc">规格：<span>红色</span>，<span>23</span></p>-->\n' +
                '          <div class="clear mg-t-10">\n' +
                '            <div class="wy-pro-pri fl">¥<em class="num font-15">' + goods[i].totalPrice + '</em></div>\n' +
                '            <div class="pro-amount fr"><span class="font-13">数量×<em class="name">' + goods[i].count + '</em></span></div>\n' +
                '          </div>\n' +
                '        </div>\n' +
                '      </div>';


      }
      $("#pro-list").html(item)

      $(".totalMoney").text(res.data.order.totalMoney);
      //优惠券
      couponItem(res)
    });
  }


  function create(type) {
    return start_pay(type, {order_sn: order_sn, addr_id: addr_id, coupon_code: coupon_code});
  }
</script>
</body>
</html>
